<template>
    <section>
        <el-tabs type="border-card" v-model="tab">
            <el-tab-pane label="用户列表" name="all">
                <all-user :user="user" ref="all" :subjects="subjects"></all-user>
            </el-tab-pane>
            <el-tab-pane label="飞书用户" name="feishu">
                <feishu-user :user="user" ref="feishu" :subjects="subjects"></feishu-user>
            </el-tab-pane>
            <el-tab-pane label="工厂用户" name="factory">
                <factory-user :user="user" ref="factory" :subjects="subjects"></factory-user>
            </el-tab-pane>
        </el-tabs>
    </section>
</template>
<script>
    import AllUser from "./components/all-user";
    import FeishuUser from "./components/feishu-user";
    import FactoryUser from "./components/factory-user"
    import {userSubjects} from "@/api/user";

    export default {
        name: 'sys_user',
        components:{
            AllUser,
            FactoryUser,
            FeishuUser
        },
        watch:{
            tab(value){
                if(!this.$refs[value].is_load){
                    this.$refs[value].is_load = true;
                    this.$refs[value].searchBtn();
                }
            }
        },
        data() {
            return {
                tab: 'all',
                user: {},
                subjects: {
                    kz: "年年有余",
                    mz: "妙哉文化",
                    yx: "有香如故",
                    xm: "一弦一木",
                    js: "锦瑟"
                }
            }
        },
        methods: {

        },
        mounted(){
            this.user = this.$store.getters.user;
            //加载用户列数据
            this.$refs['all'].is_load = true;
            this.$refs['all'].searchBtn();
        },
    }
</script>
